const { Sequelize } = require('sequelize');
const sequelize = new Sequelize('campus_epidemics', 'root', 'root', {
    host: 'localhost',
    port: '3306',
    dialect: 'mysql'
  });
  /*sequelize.authenticate().then(()=>
  {
    console.log('Connection has been established successfully.');
  }).catch (error=>{
    console.error('Unable to connect to the database:', error);
  }) **/
  const leave = sequelize.define('leave', {
    stu_id: {
        type: Sequelize.INTEGER,
    },
    reason: {
        type: Sequelize.STRING,
    },
    leavetype: {
        type: Sequelize.STRING,
    },
    starttime: {
        type: Sequelize.DATE,
    },
    endtime: {
        type: Sequelize.DATE,
    },
    state: {
        type: Sequelize.INTEGER,
    },
    createtime: {
        type: Sequelize.DATE,
    },
    classes: {
        type: Sequelize.STRING,
    }
}
);
/*leave.sync().then(()=>{
    console.log('同步')
 })*/
module.exports = {Sequelize,sequelize,leave}